// log framework
#include "cppTutorLog.h"
extern CcppTutorLog Log;
 
// util framework
#include "cppTutorUtils.h"
extern CcppTutorUtils utl;

#include "cppTutorFacadePattern.h"

#include <iostream>

using namespace std;

void Switch :: on () {
    Log << "ENTER : Switch :: on()" << endl;
    cout << "Cooler is switched on !!!" << endl;
    Log << "EXIT  : Switch :: on()" << endl;
}

void Fan :: start () {
    Log << "ENTER : Fan :: running()" << endl;
    cout << "Fan started !!!" << endl;
    Log << "EXIT  : Fan :: running()" << endl;
}

void Pump :: start () {
    Log << "ENTER : Pump :: running()" << endl;
    cout << "Pump started !!!" << endl;
    Log << "EXIT  : Pump :: running()" << endl;
}

CcppTutorFacadePattern :: CcppTutorFacadePattern () {
    Log << "ENTER : CcppTutorFacadePattern :: CcppTutorFacadePattern()" << endl;
    Log << "EXIT  : CcppTutorFacadePattern :: CcppTutorFacadePattern()" << endl;
}

CcppTutorFacadePattern :: ~CcppTutorFacadePattern () {
    Log << "ENTER : CcppTutorFacadePattern :: ~CcppTutorFacadePattern()" << endl;
    Log << "EXIT  : CcppTutorFacadePattern :: ~CcppTutorFacadePattern()" << endl;
}

void CcppTutorFacadePattern :: startCooler () {
    Log << "ENTER : CcppTutorFacadePattern :: startCooler()" << endl;
    cout << "Start the cooler !!!" << endl;
    swtch.on ();
    fan.start ();
    pump.start ();
    cout << "Cooler is running now !!!" << endl;
    Log << "EXIT  : CcppTutorFacadePattern :: startCooler()" << endl;
}
